<%@ page language="java"
	import="java.util.*,cn.ainit.sys.utils.DateTimeStr"
	pageEncoding="utf-8"%>
<%@page import="java.lang.*, java.io.*, java.sql.*, java.util.*"
	contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head id="Head1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>爱你特综合决策分析软件</title>
		<link rel="stylesheet" type="text/css"
			href="${pageContext.request.contextPath}/js/themes/default/easyui.css" />
		<link rel="stylesheet" type="text/css"
			href="${pageContext.request.contextPath}/js/themes/icon.css" />
		<link rel="stylesheet"
			href="${pageContext.request.contextPath}/pages/css/default.css"
			type="text/css"></link>
		<script type="text/javascript"
			src="${pageContext.request.contextPath}/js/jquery-1.4.4.min.js"></script>
		<script type="text/javascript"
			src="${pageContext.request.contextPath}/js/jquery.easyui.min.1.2.2.js"></script>
		<script type="text/javascript"
			src='${pageContext.request.contextPath}/js/jquery.ainit-1.0.0.js'>
	
</script>
		<!-- 
	   	width:200px; //火狐
		*width:300px; //ie7
		_width:400px; //ie6
		width:500px\0; //ie8.9
		width:500px\9;// ie9
		@media all and (width: 600px) //ie9以上
		目前兼容IE10和火狐
    -->
<style type="text/css">
.loginI {
	width: 968px;
	height: 407px;
	text-align: center;
	background-image:
		url("${pageContext.request.contextPath}/pages/images/LOGIN.png");
	position:relative
}

.lname {
	font-family: "微软雅黑";
	font-size: 13px;
	position:absolute;
	top:0px;
	left:560px
}

.rname {
	position: absolute;
	width: 100%;
	text-align: center;
	font-family: "微软雅黑";
	font-size: 13px;
	color: #ACC0FC;
	margin-top: 428px;
}

.loginInput {
	width: 120px;
	height: 17px;
	border: 1px solid #1AA5CC;
	background-color: #BDEBF7;
	font-weight: bold;
	letter-spacing: 1px;
	font-weight: bold;
}

.loginBut {
	position: absolute;
	top:0px;
	left:735px;
	width: 74px;
	height: 74px;
	cursor: pointer;
	margin-top: 194px;
}
</style>
		<script type="text/javascript">
	function login() {
		//window.location = "${pageContext.request.contextPath}/menu/getAllMenu";
		//return;
		var name = $('#loginName').val();
		var pass = $('#loginPass').val();
		//var cookie=$('#loginPass').attr("cookie");
		$.ajax( {
					type : 'post',
					url : '${pageContext.request.contextPath}/menu/login',
					data : {
						'name' : name,
						'pass' : pass,
						'login' : 'yes'
					},
					success : function(data) {
						$('#info').css('color', 'red');
						if (data == "success") {
							$('#info').html('登陆成功,加载数据中...');
							$('#info').css('color', 'green');
							window.location = "${pageContext.request.contextPath}/menu/getAllMenu";
						} else if (data == "fail") {
							$('#info').html("亲,请输入正确的用户名或密码");
							$('#info').fadeIn("slow");
							document.getElementById("loginPass").value="";
						} else if (data == "yglz") {
							$('#info').html("亲,该员工已离职不能登录");
							$('#info').fadeIn("slow");
						} else {
							$('#info').html("亲,你的帐号已在异地登录");
							$('#info').fadeIn("slow");
						}
					},
					beforeSend : function() {
						$('#info').html('正在登陆，请稍等...');
						$('#info').css('color', 'green');
						$('#info').fadeIn("slow");
					},
					error : function(obj, msg) {
						$('#info').html('网络异常!请检查网络!');
						$('#info').css('color', 'red');
						$('#info').fadeIn("slow");
					}
				});
	}

	function BindEnter(obj) {
		var button = document.getElementById("loginBut");
		if (obj.keyCode == 13) 
		{
			if($('#loginName').focus())
			{
		    	if($('#loginPass').val()=='')
		    	{
		    		$('#loginPass').focus();
		    		$('#loginName').blur();
		    		obj.returnValue = false;
		    		return;
		    	}
			}
			if($('#loginPass').focus() )
			{
				if($('#loginName').val()=='')
		    	{
		    		$('#loginPass').blur();
		    		$('#loginName').focus();
		    		obj.returnValue = false;
		    		return;
		    	}
			}
			button.click();
			obj.returnValue = false;
		}
	}
	$(function() {
		$.ajax( {
			type : 'post',
			url : '${pageContext.request.contextPath}/menu/cookie',
			data : {
				'login' : 'yes'
			},
			success : function(data) {
				console.log(data);
				$('#loginName').val(data[0]);
				var u = $('#loginName').val();
				if (u != null && u != '' && u != 'undefined') {
					$('#loginPass').focus()
				} else {
					$('#loginName').focus();
				}

			}
		});
		if (getOs() == "MSIE") {
			//$("span[class=lname]").css("marginLeft",640);
			//$("span[class=loginBut]").css("marginLeft",818);
		}
		if (getOs() == "Safari") {
			//$("span[class=lname]").css("marginLeft",210);
			//$("span[class=loginBut]").css("marginLeft",344);
		}
	});
</script>
	</head>
	<body onkeydown=BindEnter(event); style="background-color: #EBEBEB; margin: 0px; padding: 0px;">
		<div style="text-align: center; min-width: 954px; width: 100%; height: 160px; background-color: #EBEBEB;"></div>
		<span class="rname" style="color: #189BC5">2013-2014 ©上海爱你特科技发展有限公司</span>
		<div style="width: 100%; height: 200px; background-color: #EBEBEB;" align="center">
			<div class='loginI'>
				<span class="lname" style="margin-top: 210px; text-align: center;">账号:<input id='loginName' style="margin-left: 10px; padding-top: 2px;" class="loginInput" /></span>
				<span class="lname" style="margin-top: 235px; text-align: center;">密码:<input id='loginPass' onchange="changePwd()" style="margin-left: 10px;" class="loginInput" type="password" /></span>
				<span class="loginBut" id="loginBut" onclick="login()"></span>
				<div>
					<span id='info' size="60" style="float: left; color: #ff3333; margin-top: 270px; margin-left: 600px; border: none; background-color: transparent; text-align: center;" />
				</div>
			</div>
		</div>
	</body>
</html>